草庐IT

ios - CocoaPods - 无法找到 `GoogleMaps` 的规范

全部标签

ruby - RSpec 规范伪造类常量的最佳实践或解决方法

假设我有Car和Mechanic类(class)。汽车有“运行”方法。Mechanic出于某种原因需要Car。然后我编写RSpec规范。在mechanic中,我定义了一个这样的假类:classCar;end然后将mechanic在其上使用的方法stub。如果我单独运行测试,一切正常。但是当我一起运行两个测试时(rspecspec/directory/),我的Mechanicspecs使用真实的Car类。所以。我想这是因为ruby​​类是“开放的”,我已经为汽车规范加载了一次类。但是有更好的方法吗?这种情况的最佳做法是什么?这是否意味着我的代码需要一些改进,因为它可能是紧密耦合的?我在g

ruby-on-rails - 无法安装乘客模块

我正在尝试为Rails应用程序配置passenger和Nginx。我在执行乘客命令时遇到编译错误。ruby版本:ruby2.3.1p112(2016-04-26修订版54768)[x86_64-linux]Rails版本rails4.2.6错误信息:-#passenger-install-nginx-module/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:2158:in`method_missing':undefinedmethod`this'for#(NoMethodError)f

ruby - 无法在 ruby​​ 2.1.2 下安装 ruby​​-debug-ide gem

我正在尝试在ruby​​2.1.2下安装ruby​​-debug-idegem。这是为了在Rubymine中进行调试。它适用于ruby​​1.9.3但不适用于此版本。这是错误:1.3.5/lib/debugger/ruby_core_source/ruby-2.1.2-p95/***internal.h:209:error:expected‘;’,‘,’or‘)’before‘x’***这是输出。我希望能够以某种方式理解或调试它。顺便说一句,快速修复也很棒:-)Fetching:ruby-debug-ide-0.4.22.gem(100%)Buildingnativeextension

ruby - 为什么我的 cocoapods post_install Hook 没有更新我的预处理器宏?

几天来,我一直在四处寻找,试图弄清楚为什么我的post_installHook没有产生我期望的输出。这是我的Podfile:source'https://github.com/CocoaPods/Specs.git'target"SCCommon"doplatform:ios,"6.0"pod'AFNetworking','~>1.2.1'pod'Mantle','~>1.3'pod'PubNub','3.5.5'endtarget"SCCommon-TestHarness"doplatform:ios,"6.0"#inhibit_all_warnings!pod'SCCommon',

ruby-on-rails - 如何检查是否在网站上找到了图像?

我正在使用RubyonRailsv3.0.9,我想检查图像(在我的例子中是favicon.ico图标图像)已成功从网站检索到,如果没有,我想显示自定义图像。为了检索与网站相关的favicon.ico图像,在我的View文件中我有:image_tag"#{web_site.link}/favicon.ico",:size=>"16x16"其中web_site.link值类似于以下内容:http://stackoverflow.com/http://www.stackoverflow.com/http://facebook.com/...如何检查是否在网站上找到了图片(可能使用if...e

ruby-on-rails - 从 rspec 中的助手规范访问 session

我的ApplicationHelper中有一个方法可以检查我的购物篮中是否有任何元素moduleApplicationHelperdefhas_basket_items?basket=Basket.find(session[:basket_id])basket?!basket.basket_items.empty?:falseendend这是我必须测试的助手规范:require'spec_helper'describeApplicationHelperdodescribe'has_basket_items?'dodescribe'withnobasket'doit"shouldretu

ruby-on-rails - 无法使用 Capistrano 和 RVM 部署 Rails 应用程序

我有一个使用Capistrano部署的Rails应用程序。我在服务器上安装了RVM,因为我想使用更新版本的Ruby,并将其添加到我的deploy.rb文件中(根据我发现的各种说明):$:.unshift(File.expand_path('./lib',ENV['rvm_path']))require'rvm/capistrano'set:rvm_ruby_string,'1.9.2'set:rvm_type,:user当我运行capdeploy时,会发生这种情况:[staging.example.com]executingcommand**[out::staging.example.

ruby - 确定规范的 gem 文件列表

我一直使用git来确定哪些文件应该进入gem包:gem.files=`gitls-files`.split"\n"不幸的是,thisapproachhasrecentlyprovedtobeinappropriate.我需要一个独立的纯Ruby解决方案。我的第一个想法是简单地将整个目录全局化,但仅此一项就可能包含不需要的文件。所以,在研究了这个问题之后,我想到了这个:#example.gemspecdirectory=File.dirnameFile.expand_path__FILE__dotfiles=%w(.gitignore.rvmrc)ignore_file='.gitign

ruby-on-rails - 请求规范中的 stub 方法错误

我用thisbook学习了关于RoR(Ruby-2.1,Rails4.x)的api教程.这是一本值得学习的好书,但我在第5章的rspec测试中遇到了这个问题。(请参阅该章中的list5.9。)Failure/Error:authentication.stub.and_return#doesnotimplement:request源代码:classAuthenticationincludeAuthenticableenddescribeAuthenticabledolet(:authentication){Authentication.new}describe"#current_user

ruby - 无法通过 SMTP 使 ActionMailer 与 MS Exchange 一起工作

这是我的简单测试程序(使用ActionMailer3.0.8,Ruby1.9.2p180MacOSX):require'rubygems'require'action_mailer'ActionMailer::Base.delivery_method=:smtpActionMailer::Base.smtp_settings={:address=>"my_exchange_server",:port=>25,:domain=>'my_domain.org',:authentication=>:login,:user_name=>'my_user',:password=>'my_pass